package com.sgb.kjwl.view.ui.activity.pick;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;

import androidx.annotation.Nullable;
import androidx.fragment.app.FragmentManager;

import com.sgb.kjwl.AppActivity;
import com.sgb.kjwl.R;
import com.sgb.kjwl.view.ui.fragment.pick.PickListsFragment;

/**
 * 招标-列表模块
 */
public class PickListActivity extends AppActivity {

    private String fromWhere;
    private int tabPosition;
    private int tabTypePosition;
    private String searchName;

    @Override
    protected boolean statusBarDark() {
        return false;
    }

    public static void start(Context context, String fromWhere, int tabPosition) {
        Intent intent = new Intent(context, PickListActivity.class);
        Bundle bundle = new Bundle();
        bundle.putString("fromWhere", fromWhere);
        bundle.putInt("tabPosition",tabPosition);
        intent.putExtras(bundle);
        context.startActivity(intent);
    }

    public static void start(Context context, String fromWhere, int tabPosition, int tabTypePosition) {
        Intent intent = new Intent(context, PickListActivity.class);
        Bundle bundle = new Bundle();
        bundle.putString("fromWhere", fromWhere);
        bundle.putInt("tabPosition",tabPosition);
        bundle.putInt("tabTypePosition",tabTypePosition);
        intent.putExtras(bundle);
        context.startActivity(intent);
    }

    public static void start(Context context, String fromWhere, String searchName) {
        Intent intent = new Intent(context, PickListActivity.class);
        Bundle bundle = new Bundle();
        bundle.putString("fromWhere", fromWhere);
        bundle.putString("searchName",searchName);
        intent.putExtras(bundle);
        context.startActivity(intent);
    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_common_fragment);
        fromWhere = getIntent().getStringExtra("fromWhere");
        tabPosition = getIntent().getIntExtra("tabPosition",0);
        tabTypePosition = getIntent().getIntExtra("tabTypePosition",0);
        searchName = getIntent().getStringExtra("searchName");
        PickListsFragment fragment = PickListsFragment.newInstance(fromWhere,tabPosition,tabTypePosition,searchName);
        FragmentManager fragmentManager = getSupportFragmentManager();
        fragmentManager.beginTransaction().add(R.id.body, fragment).commit();
    }

}
